<?php
/**
 * 权限判断类。
 */
class auth
{
	// 用户权限常量
	const PRIV_STUDENT=0x01;
	const PRIV_TEACHER=0x02ff;
	const PRIV_ADMIN=0xffff;

	const EDIT_MEMBER=0x80; // 管理成员
 	const EDIT_LAB_STUFF=0x027e; // 管理实验室通知、项目等


	public static function check($priv)
	{
		$login=Zend_Registry::get('login');
		if ($login['AId']==0) return 0;
		$priv=(int)$priv;
		return ($login['Priv']&$priv)==$priv;
	}

	public static function priv()
	{
		$login=Zend_Registry::get('login');
		return $login['Priv'];
	}
	
	public static function name()
	{
		$login=Zend_Registry::get('login');
		return $login['Name'];
	}

	public static function aid()
	{
		$login=Zend_Registry::get('login');
		return $login['AId'];
	}

	public static function user()
	{
		$login=Zend_Registry::get('login');
		return $login['User'];
	}
};
?>
